/*
 * Copyright © 2021 http://www.hn-szzy.com/ All rights reserved.
 */
package com.xjh.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xjh.bo.LogBO;
import com.xjh.mapper.LogMapper;
import com.xjh.po.LogPO;
import com.xjh.service.LogService;
import com.xjh.utils.annotation.LogTest;
import com.xjh.utils.base.BaseBO;
import com.xjh.utils.beanutils.BeanCopyUtils;
import com.xjh.utils.pageutils.IPage;
import com.xjh.utils.pageutils.PagePlugin;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

/**
 * @author： 徐建华
 * @date： 2022/1/2
 * @description：日志操作类
 */
@Service
public class LogServiceImpl extends ServiceImpl<LogMapper, LogPO> implements LogService {
    private final LogMapper logMapper;

    public LogServiceImpl(LogMapper logMapper) {
        this.logMapper = logMapper;
    }
    @LogTest
    @Override
    public IPage<LogBO> page(HashMap<String, Object> conditionMap, Integer pageNum, Integer pageSize, String orderBy) {
        IPage<LogBO> page = PagePlugin.startPage(pageNum, pageSize, orderBy, () -> logMapper.page(conditionMap));
        return page;
    }

    @Override
    public void insert(LogBO logBO) {
        LogPO logPO = BeanCopyUtils.copyBean(logBO, LogPO.class);
        logMapper.insert(logPO);
    }
}
